#include "application.h"
#include "main.h" 
#include "gpio.h" 
uint8_t send_sbus_flag = 0;
uint8_t crsf_flag = 0;
uint16_t	iwdg_count = 0;

void loop(void)
{
	CRSF_handle_uart_in();
	if(iwdg_count >= 1000)
	{
		LL_IWDG_ReloadCounter(IWDG);
		iwdg_count = 0;
	}
}
void app_timer_callback(void)
{
  static int count2 = 0;
	static int count = 0 ;
	count++;
	if(count == 500)
	{
		if(SPORT_get_state() == CRSF_DISCONNECT)
		{
			led_off();
		}
	}
	if(count == 1000)
	{		
		led_on();
		count = 0;
	}

	count2++;
	if(count2 >= 5)
	{
		count2 = 0;
		crsf_flag = 1;
		iwdg_count++;
	}
}
